finalconc1.long <- read.csv("../results/r-csv-files/finalconc-long_water1en15_20.csv")
finalconc1.long$Species <- sub("_", " ", finalconc1.long$Species)
finalconc2.long <- read.csv("../results/r-csv-files/finalconc-long_water1en11_20.csv")
finalconc2.long$Species <- sub("_", " ", finalconc2.long$Species)
finalconc3.long <- read.csv("../results/r-csv-files/finalconc-long_air6en6_20.csv")
finalconc3.long$Species <- sub("_", " ", finalconc3.long$Species)
finalconc4.long <- read.csv("../results/r-csv-files/finalconc-long_air1en11_20.csv")
finalconc4.long$Species <- sub("_", " ", finalconc4.long$Species)
perhair1.long <- read.csv("../results/r-csv-files/perhair-long_water1en15_20.csv")
perhair1.long$Species <- sub("_", " ", perhair1.long$Species)
perhair2.long <- read.csv("../results/r-csv-files/perhair-long_water1en11_20.csv")
perhair2.long$Species <- sub("_", " ", perhair2.long$Species)
perhair3.long <- read.csv("../results/r-csv-files/perhair-long_air6en6_20.csv")
perhair3.long$Species <- sub("_", " ", perhair3.long$Species)
perhair4.long <- read.csv("../results/r-csv-files/perhair-long_air1en11_20.csv")
perhair4.long$Species <- sub("_", " ", perhair4.long$Species)
How many hairs per trial?
ggplot(finalconc1.long, aes(Species, NumofHairs, fill = Signal)) +
geom_boxplot() +
geom_jitter(pch=21, size = 1, alpha=0.3) +
scale_fill_viridis(discrete = TRUE) +
ylab("Number of olfactory hairs per trial") + xlab("") +
theme_minimal() + theme(axis.text.x = element_text(angle = 65, hjust = 1))
ggplot(finalconc1.long, aes(Signal, NumofHairs, fill=Signal)) +
geom_boxplot() +
geom_jitter(pch=21, size = 1, alpha=0.3) +
scale_fill_viridis(discrete = TRUE)+
ylab("Number of olfactory hairs per trial") + xlab("") +
theme_minimal()
Concentration captured per trial:
p1 <- ggplot(finalconc1.long, aes(Species, Concentration, fill = Signal)) +
stat_summary(shape = 21, color="black") +
geom_point(alpha = 0.3, shape = 21, color = "black") +
scale_fill_viridis(discrete = TRUE) +
xlab("") + ylab("Concentration captured per trial") +
ggtitle("Water with D = 1e-15") +
theme_bw() + theme(axis.text.x = element_text(angle = 65, hjust = 1))
p1
## No summary function supplied, defaulting to `mean_se()`
p2 <- ggplot(finalconc2.long, aes(Species, Concentration, fill = Signal)) +
stat_summary(shape = 21, color = "black") +
geom_point(alpha = 0.3, shape = 21, color = "black") +
scale_fill_viridis(discrete = TRUE) +
xlab("") + ylab("Concentration captured per trial") +
ggtitle("Water with D = 1e-11") +
theme_bw() + theme(axis.text.x = element_text(angle = 65, hjust = 1))
p2
## No summary function supplied, defaulting to `mean_se()`
p3 <- ggplot(finalconc3.long, aes(Species, Concentration, fill = Signal)) +
stat_summary(shape = 21, color = "black") +
geom_point(alpha = 0.3, shape = 21, color = "black") +
scale_fill_viridis(discrete = TRUE) +
xlab("") + ylab("Concentration captured per trial") +
ggtitle("Air with D = 6e-6") +
theme_bw() + theme(axis.text.x = element_text(angle = 65, hjust = 1))
p3
## No summary function supplied, defaulting to `mean_se()`
p4 <- ggplot(finalconc4.long, aes(Species, Concentration, fill = Signal)) +
stat_summary(shape = 21, color = "black") +
geom_point(alpha = 0.3, shape = 21, color = "black") +
scale_fill_viridis(discrete = TRUE) +
xlab("") + ylab("Concentration captured per trial") +
ggtitle("Air with D = 1e-11") +
theme_bw() + theme(axis.text.x = element_text(angle = 65, hjust = 1))
p4
## No summary function supplied, defaulting to `mean_se()`
ggplot(perhair1.long, aes(Species, Concentration, fill = Signal)) +
stat_summary(shape = 21, color = "black") +
geom_point(alpha = 0.3, shape = 21, color = "black") +
scale_fill_viridis(discrete = TRUE) +
#ylim(0,0.01) +
ylab("Concentration captured per hair") + xlab(" ") +
ggtitle("Water with D = 1e-15") +
theme_bw() + theme(axis.text.x = element_text(angle = 65, hjust = 1))
## Warning: Removed 84 rows containing non-finite values (stat_summary).
## No summary function supplied, defaulting to `mean_se()`
## Warning: Removed 84 rows containing missing values (geom_point).
ggplot(perhair2.long, aes(Species, Concentration, fill = Signal)) +
stat_summary(shape = 21, color = "black") +
geom_point(alpha = 0.3, shape = 21, color = "black") +
scale_fill_viridis(discrete = TRUE) +
#ylim(0,0.01) +
ylab("Concentration captured per hair") + xlab(" ") +
ggtitle("Water with D = 1e-11") +
theme_bw() + theme(axis.text.x = element_text(angle = 65, hjust = 1))
## Warning: Removed 84 rows containing non-finite values (stat_summary).
## No summary function supplied, defaulting to `mean_se()`
## Warning: Removed 84 rows containing missing values (geom_point).
ggplot(perhair3.long, aes(Species, Concentration, fill = Signal)) +
stat_summary(shape = 21, color = "black") +
geom_point(alpha = 0.3, shape = 21, color = "black") +
scale_fill_viridis(discrete = TRUE) +
#ylim(0,0.01) +
ylab("Concentration captured per hair") + xlab(" ") +
ggtitle("Air with D = 6e-6") +
theme_bw() + theme(axis.text.x = element_text(angle = 65, hjust = 1))
## Warning: Removed 84 rows containing non-finite values (stat_summary).
## No summary function supplied, defaulting to `mean_se()`
## Warning: Removed 84 rows containing missing values (geom_point).
ggplot(perhair4.long, aes(Species, Concentration, fill = Signal)) +
stat_summary(shape = 21, color = "black") +
geom_point(alpha = 0.3, shape = 21, color = "black") +
scale_fill_viridis(discrete = TRUE) +
#ylim(0,0.01) +
ylab("Concentration captured per hair") + xlab(" ") +
ggtitle("Air with D = 1e-11") +
theme_bw() + theme(axis.text.x = element_text(angle = 65, hjust = 1))
## Warning: Removed 84 rows containing non-finite values (stat_summary).
## No summary function supplied, defaulting to `mean_se()`
## Warning: Removed 84 rows containing missing values (geom_point).
Plotting total captured:
ggplot(finalconc1.long, aes(Species, Concentration, fill = Signal)) +
stat_summary(fun = "sum", shape = 21, color = "black") +
#geom_point(alpha = 0.3, shape = 21, color = "black") +
scale_fill_viridis(discrete = TRUE) +
#ylim(0,0.01) +
ylab("Total concentration captured") + xlab(" ") +
ggtitle("Water with D = 1e-15") +
theme_bw() + theme(axis.text.x = element_text(angle = 65, hjust = 1))
## Warning: Removed 15 rows containing missing values (geom_segment).
ggplot(finalconc2.long, aes(Species, Concentration, fill = Signal)) +
stat_summary(fun = "sum", shape = 21, color = "black") +
#geom_point(alpha = 0.3, shape = 21, color = "black") +
scale_fill_viridis(discrete = TRUE) +
#ylim(0,0.01) +
ylab("Total concentration captured") + xlab(" ") +
ggtitle("Water with D = 1e-11") +
theme_bw() + theme(axis.text.x = element_text(angle = 65, hjust = 1))
## Warning: Removed 15 rows containing missing values (geom_segment).
ggplot(finalconc3.long, aes(Species, Concentration, fill = Signal)) +
stat_summary(fun = "sum", shape = 21, color = "black") +
#geom_point(alpha = 0.3, shape = 21, color = "black") +
scale_fill_viridis(discrete = TRUE) +
#ylim(0,0.01) +
ylab("Total concentration captured") + xlab(" ") +
ggtitle("Air with D = 6e-6") +
theme_bw() + theme(axis.text.x = element_text(angle = 65, hjust = 1))
## Warning: Removed 15 rows containing missing values (geom_segment).
ggplot(finalconc4.long, aes(Species, Concentration, fill = Signal)) +
stat_summary(fun = "sum", shape = 21, color = "black") +
#geom_point(alpha = 0.3, shape = 21, color = "black") +
scale_fill_viridis(discrete = TRUE) +
#ylim(0,0.01) +
ylab("Total concentration captured") + xlab(" ") +
ggtitle("Air with D = 1e-11") +
theme_bw() + theme(axis.text.x = element_text(angle = 65, hjust = 1))
## Warning: Removed 15 rows containing missing values (geom_segment).
Plotting by signal:
finalconc1.sum <- make.sums(finalconc1.long)
finalconc2.sum <- make.sums(finalconc2.long)
finalconc3.sum <- make.sums(finalconc3.long)
finalconc4.sum <- make.sums(finalconc4.long)
ggplot(finalconc1.sum, aes(Signal, Concentration, fill=Signal)) +
geom_boxplot() +
geom_jitter(aes(fill=Signal), alpha=0.3, shape=21) +
scale_fill_viridis(discrete = TRUE) +
ylab("Total concentration captured") + xlab("") +
ggtitle("Water with D = 1e-15") +
#scale_y_continuous(trans="log10") +
theme_bw()
ggplot(finalconc2.sum, aes(Signal, Concentration, fill=Signal)) +
geom_boxplot() +
geom_jitter(aes(fill=Signal), alpha=0.3, shape=21) +
scale_fill_viridis(discrete = TRUE) +
ylab("Total concentration captured") + xlab("") +
ggtitle("Water with D = 1e-11") +
#scale_y_continuous(trans="log10") +
theme_bw()
ggplot(finalconc3.sum, aes(Signal, Concentration, fill=Signal)) +
geom_boxplot() +
geom_jitter(aes(fill=Signal), alpha=0.3, shape=21) +
scale_fill_viridis(discrete = TRUE) +
ylab("Total concentration captured") + xlab("") +
ggtitle("Air with D = 6e-6") +
#scale_y_continuous(trans="log10") +
theme_bw()
ggplot(finalconc4.sum, aes(Signal, Concentration, fill=Signal)) +
geom_boxplot() +
geom_jitter(aes(fill=Signal), alpha=0.3, shape=21) +
scale_fill_viridis(discrete = TRUE) +
ylab("Total concentration captured") + xlab("") +
ggtitle("Air with D = 1e-11") +
#scale_y_continuous(trans="log10") +
theme_bw()
Stats:
modelsum1 <- lm(Concentration~Signal, data=finalconc1.sum)
anova(modelsum1)
## Analysis of Variance Table
##
## Response: Concentration
## Df Sum Sq Mean Sq F value Pr(>F)
## Signal 2 0.06174 0.03087 0.1284 0.8807
## Residuals 12 2.88459 0.24038
modelsum2 <- lm(Concentration~Signal, data=finalconc2.sum)
anova(modelsum2)
## Analysis of Variance Table
##
## Response: Concentration
## Df Sum Sq Mean Sq F value Pr(>F)
## Signal 2 0.568 0.2838 0.0679 0.9347
## Residuals 12 50.164 4.1803
modelsum3 <- lm(Concentration~Signal, data=finalconc3.sum)
anova(modelsum3)
## Analysis of Variance Table
##
## Response: Concentration
## Df Sum Sq Mean Sq F value Pr(>F)
## Signal 2 3.5230e+12 1.7615e+12 0.0389 0.962
## Residuals 12 5.4317e+14 4.5265e+13
modelsum4 <- lm(Concentration~Signal, data=finalconc4.sum)
anova(modelsum4)
## Analysis of Variance Table
##
## Response: Concentration
## Df Sum Sq Mean Sq F value Pr(>F)
## Signal 2 235.7 117.85 0.2703 0.7676
## Residuals 12 5230.9 435.91
Phylogenetically corrected ANOVA:
bug.tree <- read.tree("../data/parameters/Treefor15species-pyloANOVA.tree")
Species.list <- sub(" ", "_", finalconc1.sum$Species)
Species.list <- sub("_sp", "_sp.", Species.list)
test1 <- prep.phyloanova(finalconc1.sum, Species.list)
phylANOVA(bug.tree, test1[[1]], test1[[2]])
## ANOVA table: Phylogenetic ANOVA
##
## Response: y
## Sum Sq Mean Sq F value Pr(>F)
## x 0.023636 0.023636 0.105131 0.835
## Residual 2.922690 0.224822
##
## P-value based on simulation.
## ---------
##
## Pairwise posthoc test using method = "holm"
##
## Pairwise t-values:
## chemical visual
## chemical 0.00000 -0.32424
## visual 0.32424 0.00000
##
## Pairwise corrected P-values:
## chemical visual
## chemical 1.000 0.835
## visual 0.835 1.000
## ---------
test2 <- prep.phyloanova(finalconc2.sum, Species.list)
phylANOVA(bug.tree, test2[[1]], test2[[2]])
## ANOVA table: Phylogenetic ANOVA
##
## Response: y
## Sum Sq Mean Sq F value Pr(>F)
## x 0.163392 0.163392 0.042005 0.89
## Residual 50.567787 3.889830
##
## P-value based on simulation.
## ---------
##
## Pairwise posthoc test using method = "holm"
##
## Pairwise t-values:
## chemical visual
## chemical 0.000000 0.204951
## visual -0.204951 0.000000
##
## Pairwise corrected P-values:
## chemical visual
## chemical 1.00 0.89
## visual 0.89 1.00
## ---------
test3 <- prep.phyloanova(finalconc3.sum, Species.list)
phylANOVA(bug.tree, test3[[1]], test3[[2]])
## ANOVA table: Phylogenetic ANOVA
##
## Response: y
## Sum Sq Mean Sq F value Pr(>F)
## x 1.283213e+12 1.283213e+12 0.030586 0.897
## Residual 5.454140e+14 4.195492e+13
##
## P-value based on simulation.
## ---------
##
## Pairwise posthoc test using method = "holm"
##
## Pairwise t-values:
## chemical visual
## chemical 0.000000 0.174887
## visual -0.174887 0.000000
##
## Pairwise corrected P-values:
## chemical visual
## chemical 1.000 0.897
## visual 0.897 1.000
## ---------
test4 <- prep.phyloanova(finalconc4.sum, Species.list)
phylANOVA(bug.tree, test4[[1]], test4[[2]])
## ANOVA table: Phylogenetic ANOVA
##
## Response: y
## Sum Sq Mean Sq F value Pr(>F)
## x 102.1849 102.1849 0.247634 0.727
## Residual 5364.3758 412.6443
##
## P-value based on simulation.
## ---------
##
## Pairwise posthoc test using method = "holm"
##
## Pairwise t-values:
## chemical visual
## chemical 0.000000 0.497629
## visual -0.497629 0.000000
##
## Pairwise corrected P-values:
## chemical visual
## chemical 1.000 0.727
## visual 0.727 1.000
## ---------
Test number of hairs:
finalconc1.long$Species <- factor(finalconc1.long$Species)
x.sums <- rep(NA, nlevels(finalconc1.long$Species))
x.signals <- rep(NA, nlevels(finalconc1.long$Species))
for (i in 1:nlevels(finalconc1.long$Species)){
x <- subset(finalconc1.long,
finalconc1.long$Species == levels(finalconc1.long$Species)[i])
x.sums[i] <- sum(x$NumofHairs)
x.signals[i] <- x$Signal[1]
}
finalhairs.sums <- data.frame("Species"= levels(finalconc1.long$Species),
"Signal" = x.signals,
"NumofHairs" = x.sums)
signals <- finalhairs.sums$Signal
signals[signals=="both"] <- "chemical"
signals <- factor(signals)
names(signals) <- Species.list
sig.sums <- finalhairs.sums$NumofHairs
names(sig.sums) <- Species.list
phylANOVA(bug.tree, signals, sig.sums)
## ANOVA table: Phylogenetic ANOVA
##
## Response: y
## Sum Sq Mean Sq F value Pr(>F)
## x 2520.268 2520.268 1.747038 0.365
## Residual 18753.732 1442.595
##
## P-value based on simulation.
## ---------
##
## Pairwise posthoc test using method = "holm"
##
## Pairwise t-values:
## chemical visual
## chemical 0.000000 1.321756
## visual -1.321756 0.000000
##
## Pairwise corrected P-values:
## chemical visual
## chemical 1.000 0.365
## visual 0.365 1.000
## ---------
anova(lm(NumofHairs~Signal, data=finalhairs.sums))
## Analysis of Variance Table
##
## Response: NumofHairs
## Df Sum Sq Mean Sq F value Pr(>F)
## Signal 2 2592.3 1296.2 0.8326 0.4586
## Residuals 12 18681.7 1556.8
Plotting density of capture:
ggplot(finalconc1.long, aes(Concentration, fill=Signal)) +
geom_density(n = 20, alpha=0.5) +
scale_fill_viridis(discrete = T) +
theme_minimal()
ggplot(finalconc2.long, aes(Concentration, fill=Signal)) +
geom_density(n = 20, alpha=0.5) +
scale_fill_viridis(discrete = T) +
theme_minimal()
ggplot(finalconc3.long, aes(Concentration, fill=Signal)) +
geom_density(n = 20, alpha=0.5) +
scale_fill_viridis(discrete = T) +
theme_minimal()
ggplot(finalconc4.long, aes(Concentration, fill=Signal)) +
geom_density(n = 20, alpha=0.5) +
scale_fill_viridis(discrete = T) +
theme_minimal()